﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;

namespace ConfExpert.Forms.Depo.Westbrook
{
    public partial class StokDurumu : XForm
    {
        public StokDurumu()
        {
            InitializeComponent();
        }

        private void StokDurumu_Load(object sender, EventArgs e)
        {

            gvKumas.Init("GetOrdersihtiyac", 75);
            gvKumas.AddDetailGrid(gvOrder, "ProductId", 1);
            gvKumas.AddDetailGrid(gvRoll, "ProductId", 2);

            gvKumas.OptionsBehavior.Editable = gvOrder.OptionsBehavior.Editable = gvRoll.OptionsBehavior.Editable = false;

            gvKumas.AddSummary("QtyNeeded", "QtyDepo", "BlockedQty", "AvailableQty");
            gvOrder.AddSummary("Toplam", "QtyNeeded");
            gvRoll.AddSummary("Qty");

            gvKumas.FormatAsNumber(1, "QtyNeeded", "QtyDepo", "BlockedQty", "AvailableQty");

            gvKumas.BestFitColumns();
            btnGuncelle.ItemClick += btnGuncelle_ItemClick;
        }

        void btnGuncelle_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gvKumas.EndEditing();
            gvKumas.RefreshDataSource(true, "GetOrdersihtiyac", 75);
            gvKumas.BestFitColumns();
        }
    }
}